import VueRouter from 'vue-router'
import { v4 as uuidv4 } from 'uuid'
export const enhance = function (prop) {
  const nativeFn = VueRouter.prototype[prop]
  VueRouter.prototype[prop] = function (path, success, error = () => {}) {
    return nativeFn.call(this, path, success, error)
  }
}
export const getUserTempId = function () {
  if (localStorage.getItem('userTempId'))
    return localStorage.getItem('userTempId')
  else {
    let userTempId = uuidv4()
    localStorage.setItem('userTempId', userTempId)
    return userTempId
  }
}
